<?php
namespace Home\Controller;
use Think\Controller;

/**
 * 前端公共控制器
 */
class CommonController extends Controller{
	
	public function _initialize(){
		//用户session	
		$this->user = get_session_user();
		$this->uid = session('uid');
		if(session('uid')){
			$this->infonum =count(M('inform')->where(array('uid'=>session('uid'),'islook'=>0))->select());
		}
		if(I('isshare') || session('isshare')){//如果是阅读原文进来的 配置全段所有的微信分享
			session('isshare','1');
			$this->isshare = session('isshare');
			if(I('shareaid')){//记录活动的shareaid
				session('shareid',I('shareaid'));
			}
			//微信分享活动信息
			$share_act = M('activity')->where(array('id'=>session('shareid')))->find();
			$this->share_act = $share_act;
			if($share_act['shareurl']){
				$this->shareurl = $share_act['shareurl'];
			}else{//微信图文链接为空，则用活动详情链接
				$this->shareurl = $share_act['acturl'];
			}
			//微信分享接口配置
			$jssdk = new \Org\Util\JSSDK;
			$signPackage = $jssdk -> getSignPackage();
			$this -> wx_config = $signPackage;//微信配置
			$this->httpsite = C('HTTPSITE');//http://www/gzredd.com
		}
	}
	
}